package com.abocode.aichat.server.context.channel;

import com.abocode.aichat.data.Entity;
import com.abocode.aichat.util.UUIDUtils;
import io.netty.channel.Channel;
import lombok.Getter;
import lombok.Setter;

/**
 * @author guanxf
 */
@Getter
@Setter
public class ChannelWrapper {

    private Channel channel;
    private String channelId;
    private Entity entity;
    private boolean ready = false;
    public ChannelWrapper(Channel channel) {
        this.channel = channel;
        this.channelId = UUIDUtils.uuid();
    }
    public void registerEntity(Entity entity) {
        if (entity == null) {
            throw new RuntimeException("entity is null");
        }
        this.entity = entity;
        this.ready = true;
    }
}
